using UnityEngine;
using System;

namespace GameCore
{
    public class ClickableObject : MonoBehaviour
    {
        public SpriteRenderer sr;
        public Color normalColor = Color.gray;
        public Color hoverColor = Color.white;
        public Color pressedColor = Color.cyan;

        public event Action OnClick;

        private void OnMouseDown()
        {
            sr.color = pressedColor;
            OnClick?.Invoke();
        }

        private void OnMouseUp()
        {
            sr.color = hoverColor;
        }

        private void OnMouseEnter()
        {
            sr.color = hoverColor;
        }

        private void OnMouseExit()
        {
            sr.color = normalColor;
        }
    }
}